//------------------------------------------------------------------------------
// <copyright file="Base64Encoder.h" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

#pragma once

namespace Microsoft { namespace Internal { namespace GamesTest { namespace Rpc { namespace Server { namespace Encoding { namespace Base64
{
	class Base64Encoder
	{
	public:
		/// <summary>
		/// Encodes a binary buffer into a Base64 encoded string.
		/// </summary>
		/// <param name="buffer">The buffer to encode.</param>
		/// <param name="bufferLength">The length of the buffer to encode.</param>
		static std::wstring Encode(const unsigned __int8* buffer, unsigned int bufferLength);

		/// <summary>
		/// Decodes a Base64 encoded string into a binary buffer.
		/// </summary>
		/// <param name="buffer">The string to decode.</param>
		/// <param name="stringLength">The length of the string to decode.</param>
		/// <param name="outBufferLength">The length of the buffer to returned from this function.</param>
		static std::shared_ptr<unsigned __int8> Decode(const wchar_t* base64String, unsigned int stringLength, unsigned int& outBufferLength);
	};
}}}}}}}